var $J = jQuery.noConflict();

function loadSiteDynamicMessage(){
    DynamicInfomationService.subscribe(5, function(ret){
        var html = getHTMLTag(ret);
        $J('#site_dynamic').html(html);
    })
}

function loadFriendDynamicMessage(){
    if (userNo) {
        UserActivityService.getDynamicActivity(userNo, function(ret){
            var html = getHTMLTag(ret);
            $J('#friend_dynamic').html(html);
        })
    }
}

function repeat(){
    window.setInterval('loadSiteDynamicMessage()', 10000);
    window.setInterval('loadFriendDynamicMessage()', 10000);
}

function getHTMLTag(sdms){
    var html = '';
    for (var i = 0; i < sdms.length; i++) {
        var sdm = sdms[i]
        html += '<div class="headerColumnType1ContentLine"><a href=""><b class="b">' +
        sdm.message +
        '</b></a></div>';
    }
    return html;
}

$J(repeat);
